import java.util.Scanner;

public class TestDemo {

    public static void Enter(){
        int count = 3;
        Scanner scanner = new Scanner(System.in);
        while(count != 0){
            System.out.println("请输入密码：");
            String password = scanner.nextLine();
            if(password.equals("123456")){
                System.out.println("登录成功！");
                break;
            }else{
                count--;
                System.out.println("密码错误，你还有"+ count +"次机会");
            }
        }

    }

    public static void main(String[] args) {
        Enter();
    }
}
